package com.junbao.module.main.kt

/**
 *    author : Majunbao
 *    github : https://github.com/MaJunBaox
 *    time   : 2022/8/28 11:05 上午
 *    desc   :
 */


fun main() {
   // test1()
//    test2(2)
//
//    Thread{
//
//    }.start();
//
//
//    Thread(object :Runnable{
//        override fun run() {
//        }
//    })


    //LogStrategyProxy(LogStrategyImpl()).log("majunbao")

//    var name:String  by XxxDelegate()
//    println("测试输出：$name")
//    name = "nideyidaa"
//    println("测试输出：$name")

    println("测试开始")
    println("测试第一次输出 " + temp)
    println("测试第二次输出 " + temp)
    println("测试结束")


}

val temp :String by lazy {
    println("初始化了")
    "666666"
}

val hh:String by lazy {
    return@lazy "3333"
}

fun add(vararg array : Int) : Int{
    var count = 0
    array.forEach {
        count+=it
    }
    return count
}

private fun test2(num:Int){
    when(num){
        1-> println("1")
        in 2..4 -> println("2..4")
        6-> println("6")
        else -> println("else")
    }
}


private fun test1() {
    var number = 100
    println("商品数量有${number}")
    println("商品数量有$number")
    println("商品数量有\$number")

    //数组

    var array1 = intArrayOf(1, 2, 3)

    var array = arrayListOf("1", "2", "#")

    for (i in array) {
        println(i)
    }

    array.forEach {
        println(it)
    }

    println("================")
    for (i in IntRange(0, array.size - 1)) {
        println(array[i])
    }
    println("================")


    for (i in 0..array.size - 1) {
        println(array[i])
    }
    println("================")


    for (i in 0 until array.size) {
        println(array[i])
    }
    println("================")

    for (e in array) {
        println(e)
    }

    println("================")
}